#!/bin/bash

function line()
{
	echo "---------------------------------------"
}

#usuwa proces w oparciu o grepa i awk'a rozdzialajacego po kolumnach
if [ $# -eq 0 ]; then
	echo "Please enter process name while running script... terminating..."
	exit
fi

#echo $1

process_name=$1

#ps -aux | awk '{print $2,$11}' >

#echo var
#set -- $var
line

var=$(ps aux | awk '{print $2,$11}' | grep "^[0-9]\+ $process_name" | awk '{print $1 }')

export IFS=";"
echo $var
pids="$var"
for pid in $pids; do
  echo "killing process with pid equal: " $pid
  kill -9 $pid
done

line

#grep '^cron$' tmp_file

